<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="http://v3.bootcss.com/favicon.ico">
    
    <title>Examinee Exam Place Choose</title>
    
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" type="text/css" href="../css/bootstrap.css">
    
    <!-- Custom styles for this template -->
    <link rel="stylesheet" type="text/css" href="../css/navbar-fixed-top.css">
    
    <!-- Login styles for this page -->
    <link rel="stylesheet" type="text/css" href="../css/style.css">
    
    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="../js/ie-emulation-modes-warning.js"></script>
    
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
    body{
    	font-family: '微软雅黑';
		background-image:url(../images/eLogin.png);
    }
    </style>
</head>

<body>

    <!-- Fixed navbar -->
    <nav class="navbar navbar-own navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <!--<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>-->
          <a class="navbar-brand" href="#"><font color="#ffffff">自主招生管理系统</font></a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
          	<li><a href="ExamPerInfo.html"><font color="#fff">查看个人信息</font></a></li>
            <li class="dropdown">
            	<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><font color="#ffffff">考试流程</font><span class="caret"></span></a>
          		<ul class="dropdown-menu" role="menu">
                    <li><a id="sign">网上报名</a></li>
                    <li><a id = "selectEp">选择考点</a></li>
                    <li><a  id = "print">打印准考证</a></li>
                    <li><a href="ExamScore.html">查询成绩</a></li>
              	</ul>
            </li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a onclick = "logout()"><font color="#ffffff">注销</font></a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </nav>

    <div class="inner-info" align="center">

      <!-- Main component for a primary marketing message or call to action -->
      <div class="es-reg" align="center" style="max-width:1100px">
      	<div class="examEP">
        	<h2>考点选择</h2>
            <form class="epChoose">
            	<table class="table table-hover table-bordered">
                	<tr>
                    	<td colspan="6" align="center" style="font-size:36px">2016年全国自主招生考试考点</td>
                    </tr>
                    <tr>
                    	<th colspan="1">姓名</th><td colspan="3" id="name"></td>
                    </tr>
                    <tr>
                    	<th colspan="1">考点选择</th>
                    	<td colspan="3">
                    		<select id="ep" class="form-control"> 
                    		</select>
                    	</td>
                    </tr>
                    <tr>
                    	<th colspan="1">地址</th>
                    		<td colspan="3" id = epAddress>
                    		</td>
                    </tr>
                    
                </table>
            </form>
        </div>
               
        <div class="row">
        	<div class="col-md-3"></div>
        	<div class="col-md-3"><a class="btn btn-own btn-block" type="button" onclick = "submit()">确定</a><!--alert--></div>
        	<div class="col-md-3"><a class="btn btn-own btn-block" type="button" href="ExamProcess.html">返回</a></div>
            <div class="col-md-3"></div>
        </div>
      </div>
	</div> <!-- /container -->
    <footer class="examFooter">
        <p align="center">Copyright © 2015 ECNU・</p>
    </footer>


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="../js/jquery.js"></script>
    <script src="../js/bootstrap.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../js/ie10-viewport-bug-workaround.js"></script>
    <script src="../js/jquery.json.js"></script>
    <script src="../js/logout.js"></script>
  	<script>
  	function submit()
  	{
  		var select = eval("("+$("#ep").val()+")");
			$("#epAddress").html(select.epAddress);
			//alert(select.epAddress);
			$.ajax({
				url:'../chooseEp.action',
				type:'post',
				dataType:'json',
				data:{userId:sessionStorage.getItem("userId"),epId:select.epId},
				success:function(data)
				{
					var result = eval("("+data+")");
					
					if(result.flag=="true")
						{
						alert("选择成功");
						location.href = "ExamProcess.html";
						}
				}
				
			})
				
  	}
  		$(document).ready(function()
  				{
  			
  			
  			$.ajax({
  				url:'../getSessionPara.action',
  				type:'post',
  				dataType:'json',
  				data:{
  					propertyName:'isLogin'
  				},
  				success:function(data)
  				{
  					if(data!="true")
  						{
  						alert("请先登录");
  						location.href="ExamLogin.htm";
  						}
  					else
  						{
  						$.ajax({
  			  				url:'../queryUser.action',
  			  				type:'post',
  			  				dataType:'json',
  			  				data:{userId:sessionStorage.getItem("userId")},
  			  				success:function(data)
  			  				{
  			  					var result = eval("("+data+")");
  			  					if(result.flag=="true")
  			  						{
  			  							var userInfo = eval("(" + result.userInfo + ")");
  			  							$("#name").html(userInfo.name);
  			  						}
  			  					if(result.epState=="0")
  			  						{
  			  					$.ajax({
  		  			  				url:'../getEp.action',
  		  			  				type:'post',
  		  			  				dataType:'json',
  		  			  				data:{pageNum:1},
  		  			  				success:function(data)
  		  			  				{
  		  			  					var result = eval("("+data+")");
  		  			  					if(result.flag=="true")
  		  			  						{
  		  			  						var array = eval("("+result.array+")");
  		  			  						var html = "";
  		  			  						var address = "";
  		  			  						$.each(array,function(i,value)
  		  			  								{
  		  			  							if(i==0)
  		  			  								{
  		  			  								address = value.epAddress;
  		  			  								}
  		  			  							html+="<option value = " + JSON.stringify(value) + ">" + value.epname
  		  			  							+ "</option>";
  		  			  								});
  		  			  						$("#ep").html(html);
  		  			  						$("#epAddress").html(address);
  		  			  						//$("#proEpid").val(proInfo.epId);
  		  			  						}
  		  			  				}
  		  			  			});
  			  						}
  			  					else
  			  						{
  			  						alert("已经选择考点无法修改");
  			  						}
  			  				}
  			  			})
  						}
  				}
  			});
  			$("#ep").change(function()
  					{
  				var select = eval("("+$("#ep").val()+")");
  				$("#epAddress").html(select.epAddress);
  				//alert(select.epAddress);
  					});
  			
  				})
  	</script>

</body></html>